//
// Created by zhou on 2021/11/28.
//
#include <vector>
#include <iostream>
using namespace std;
class Solution {
public:
    vector<int> searchRange(vector<int>& nums, int target) {
        int size=nums.size();
        int left1=0,right1=size-1;
        while(left1<right1){
            if(nums[left1]!=target)left1++;

            if(nums[right1]!=target)right1--;
            if(nums[left1]==target&&nums[right1]==target)break;
        }
        if(nums[left1]==target)
            return {left1,right1};
        else return {-1,-1};
    }
};
int main(){
    vector<int> nums={1,2,3,3,3,4};
    Solution solution;
    vector<int>ans=solution.searchRange(nums,3);
    for(int i=0;i<ans.size();i++){
        cout<<ans[i]<<endl;
    }
}